package de.android.learn;

import java.io.IOException;
import java.io.InputStream;

import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.webkit.WebView;

public class HilfeActivity extends Activity{
	@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.hilfe);
        
        final WebView view = (WebView) findViewById(R.id.webview);
        view.getSettings().setJavaScriptEnabled(true);
        initialisiereWebKit(view,this);
        view.bringToFront();
    }
	private void initialisiereWebKit(WebView view, Context context){
		final String mimetype = "text/html";
		final String encoding = "UTF-8";
		String htmlData;
		int contextMenuId = R.raw.hilfe;
		InputStream is = context.getResources().openRawResource(contextMenuId);
		
		try{
			if(is != null && is.available() > 0){
				final byte[] bytes = new byte[is.available()];
				is.read(bytes);
				htmlData = new String(bytes);
				view.loadDataWithBaseURL(null, htmlData, mimetype, encoding, null);
			}
		} catch (IOException e){}
	}
}
